import { Redirect } from 'umi'
import {useAuth} from '../hooks/index'
//useAuth 自定义hook
export default (props:any) => {
  const { isLogin } = useAuth();
  // const isLogin = localStorage.getItem('token')
  if (isLogin) {
    return <div>{ props.children }</div>;
  } else {
    return <Redirect to="/login" />;
  }
}
